﻿using System;
using System.Collections.Generic;
using System.Data;
using System.Linq;
using System.Text;
using System.Threading.Tasks;
using Model;
namespace DAL
{
    public class LoginDAL
    {
        //public DataTable GetALLAsset() {
        //    string sql = "select * from AssetInfo";
        //    return DBHelper.GetTable(sql);
        //}
        public EmployInfo Login(string username, string password) {
            string sql = string.Format(" select * from EmpolyInfo where EmpolyName='{0}' and EmpolyPwd='{1}'", username, password);
            DataTable dt = DBHelper.GetTable(sql);
            EmployInfo info = new EmployInfo();
            if (dt.Rows.Count>0)
            {
                info.EmpolyID = Convert.ToInt32(dt.Rows[0]["EmpolyID"]);
                info.EmpolyName = dt.Rows[0]["EmpolyName"].ToString();
            }
            return info;
        }
    }
}
